package com.sunsharing.common.loadbalance;

import com.sunsharing.common.LoadBalance;

import java.util.Random;

/**
 * Created with IntelliJ IDEA.
 * User: criss
 * Date: 13-4-11
 * Time: 下午3:45
 * To change this template use File | Settings | File Templates.
 */
public class RandomLoadBalance implements LoadBalance {

    @Override
    public int getIndex(int len) {
        if(len==1)
        {
            return 0;
        }
        Random r = new Random();
        int i = r.nextInt(len);
        return i;
    }

    @Override
    public int getWeight() {
        return 0;
    }
}
